package com.web;

import com.pojo.KeCheng_db;
import com.service.KeChengService_db;
import com.util.ResultEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/kecheng")
public class KeChengController_db {
    @Autowired
    private KeChengService_db keChengServiceDb;

    @RequestMapping("/show")
    public ResultEntity list(String name,Integer del){
        return ResultEntity.ok(keChengServiceDb.list(name, del));
    }

    @RequestMapping("/all")
    public ResultEntity listAll(Integer order, Integer limit) {
        return ResultEntity.ok(keChengServiceDb.listAll(order, limit));
    }

    @RequestMapping("findid")
    public ResultEntity findById(Integer id) {
        return ResultEntity.ok(keChengServiceDb.findById(id));
    }

    @RequestMapping("listid")
    public ResultEntity listById(Integer tId){
        return ResultEntity.ok(keChengServiceDb.listById(tId));
    }

    @RequestMapping("findhot")
    public ResultEntity findHot() {
        return ResultEntity.ok(keChengServiceDb.listHot());
    }

    @RequestMapping("/add")
    public ResultEntity add(KeCheng_db keChengDb) {
        return ResultEntity.ok(keChengServiceDb.add(keChengDb));
    }

    @RequestMapping("/update")
    public ResultEntity update(KeCheng_db keChengDb) {
        return ResultEntity.ok(keChengServiceDb.update(keChengDb));
    }

    @RequestMapping("/updel")
    public ResultEntity updateDel(Integer kDel,Integer kId){
        return ResultEntity.ok(keChengServiceDb.updateDel(kDel,kId));
    }

    @RequestMapping("/uphot")
    public ResultEntity updateHot(Integer kHot,Integer kId){
        return ResultEntity.ok(keChengServiceDb.updateHot(kHot, kId));
    }

    @RequestMapping("/delete")
    public ResultEntity del(Integer kId) {
        return ResultEntity.ok(keChengServiceDb.del(kId));
    }

}
